import request from "@/utils/request";
import { ArtistQuery, ArtistPageResult, ArtistForm, ArtistListByPinyiDTO, Artist } from "./model";

/**
 * 艺术机构API
 */
class ArtistAPI {
  /**
   * 获取艺术机构分页数据
   *
   * @param queryParams
   */
  static getPage(queryParams?: ArtistQuery) {
    return request<any, ArtistPageResult>({
      url:
        "/artist/getPage?currentPage=" +
        queryParams?.pageNum +
        "&size=" +
        queryParams?.pageSize,
      method: "post",
      data: queryParams,
    });
  }

  /**
   * 艺术家分页带艺术机构
   */
  static getPageWithDepart(queryParams?: ArtistQuery) {
    return request<any, ArtistPageResult>({
      url:
        "/artist/getPageWithDepart?currentPage=" +
        queryParams?.pageNum +
        "&size=" +
        queryParams?.pageSize,
      method: "post",
      data: queryParams,
    });
  }

  /**
   * 新增艺术机构
   *
   * @param data
   */
  static add(data: ArtistForm) {
    return request({
      url: "/artist/add",
      method: "post",
      data: data,
    });
  }
  /**
   * 修改艺术机构
   * @param data 
   * @returns 
   */
  static update(data: ArtistForm) {
    return request({
      url: "/artist/edit",
      method: "post",
      data: data,
    });
  }

  /**
   * 删除艺术机构
   * @param data 
   * @returns 
   */
  static delete(data: ArtistForm) {
    return request({
      url: "/artist/delete",
      method: "post",
      data: data,
    });
  }
  /**
   * 字幕排序艺术家
   * @param data
   * @returns
   */
  static getListByFirstPy(data: ArtistForm) {
    return request<any, ArtistListByPinyiDTO[]>({
      url: "/artist/getListByFirstPy",
      method: "post",
      data: data,
    });
  }

  /**
   * 删除模块艺术品
   * @param data 
   * @returns 
   */

  static removeArtistRelative(data: ArtistForm) {
    return request({
      url: "/artist/removeArtistRelative",
      method: "post",
      data: data,
    });
  }

  /**
   * 获取未关联的艺术品分页数据
   * @param queryParams 
   * @returns 
   */
  static getPageNoRelative(queryParams?: ArtistQuery) {
    return request<any, ArtistPageResult>({
      url:
        "/artist/getPageNoRelative?currentPage=" +
        queryParams?.pageNum +
        "&size=" +
        queryParams?.pageSize,
      method: "post",
      data: queryParams,
    });
  }
  /**
   * 获取已关联的艺术品分页数据
   * @param queryParams 
   * @returns 
   */
  static getPageRelative(queryParams?: ArtistQuery) {
    return request<any, ArtistPageResult>({
      url:
        "/artist/getPageRelative?currentPage=" +
        queryParams?.pageNum +
        "&size=" +
        queryParams?.pageSize,
      method: "post",
      data: queryParams,
    });
  }

  /**
   * 添加到艺术品关联表
   * @param data 
   * @returns 
   */
  static addToRelative(data: ArtistForm) {
    return request({
      url: "/artist/addToRelative",
      method: "post",
      data: data,
    });
  }

  /**
   * 字幕排序艺术家
   * @param data
   * @returns
   */
  static saveDepartRelativeSort(data: ArtistForm[]) {
    return request({
      url: "/artist/save/depart/sort",
      method: "post",
      data: data,
    });
  }

  static getInfo(data: ArtistForm) {
    return request<Artist>({
      url: "/artist/getInfo",
      method: "post",
      data: data,
    });
  }




}

export default ArtistAPI;
